proc ban {nick handle chan otbn1 otbn botnet2 botnet3 host} {
global home botnick bcast
if {$otbn1 == ""} {
  putquick "NOTICE $nick :\0034ERROR - Invalid Syntax - Should Be - (/msg) $botnick ban <#channel> <nick> OR <mask> <time> <reason>"
  return 0
  }
if {![botisop $chan]} {
  putquick "NOTICE $nick :\0034ERROR - Bot dosen't have op status (+o) on $chan"
  return 0
  }
if {[string tolower $otbn1] == [string tolower $botnick]} {
  putquick "NOTICE $nick :\0034ERROR - Unable To Ban This Bot.  Use\00312 $botnick part \0034instead\003"
  return 0
  }
 set time 0
 set reason $botnet2
if {[string tolower $otbn] == "1m"} {
  set time 1
  set reason $botnet3
  }
if {[string tolower $otbn] == "2m"} {
  set time 2
  set reason $botnet3
  }
if {[string tolower $otbn] == "3m"} {
  set time 3
  set reason $botnet3	
  }
if {[string tolower $otbn] == "4m"} {
  set time 4
  set reason $botnet3	
  }
if {[string tolower $otbn] == "5m"} {
  set time 5
  set reason $botnet3
  }
if {[string tolower $otbn] == "6m"} {
  set time 6
  set reason $botnet3
  }
if {[string tolower $otbn] == "7m"} {
  set time 7
  set reason $botnet3	
  }
if {[string tolower $otbn] == "8m"} {
  set time 8
  set reason $botnet3	
  }
if {[string tolower $otbn] == "9m"} {
  set time 9
  set reason $botnet3
  }
if {[string tolower $otbn] == "10m"} {
  set time 10
  set reason $botnet3
  }
if {[string tolower $otbn] == "11m"} {
  set time 11
  set reason $botnet3  
  }
if {[string tolower $otbn] == "12m"} {
  set time 12
  set reason $botnet3	
  }
if {[string tolower $otbn] == "13m"} {
  set time 13
  set reason $botnet3	
  }
if {[string tolower $otbn] == "14m"} {
  set time 14
  set reason $botnet3    
  }
if {[string tolower $otbn] == "15m"} {
  set time 15
  set reason $botnet3    
  }
if {[string tolower $otbn] == "16m"} {
  set time 16
  set reason $botnet3	
  }
if {[string tolower $otbn] == "17m"} {
  set time 17
  set reason $botnet3	
  }
if {[string tolower $otbn] == "18m"} {
  set time 18
  set reason $botnet3	
  }
if {[string tolower $otbn] == "19m"} {
  set time 19
  set reason $botnet3	
  }
if {[string tolower $otbn] == "20m"} {
  set time 20
  set reason $botnet3	
  }
if {[string tolower $otbn] == "21m"} {
  set time 21
  set reason $botnet3	
  }
if {[string tolower $otbn] == "22m"} {
  set time 22
  set reason $botnet3	
  }
if {[string tolower $otbn] == "23m"} {
  set time 23
  set reason $botnet3	
  }
if {[string tolower $otbn] == "24m"} {
  set time 24
  set reason $botnet3	
  }
if {[string tolower $otbn] == "25m"} {
  set time 25
  set reason $botnet3	
  }
if {[string tolower $otbn] == "26m"} {
  set time 26
  set reason $botnet3	
  }
if {[string tolower $otbn] == "27m"} {
  set time 27
  set reason $botnet3	
  }
if {[string tolower $otbn] == "28m"} {
  set time 28
  set reason $botnet3	
  }
if {[string tolower $otbn] == "29m"} {
  set time 29
  set reason $botnet3	
  }
if {[string tolower $otbn] == "30m"} {
  set time 30
  set reason $botnet3	
  }
if {[string tolower $otbn] == "1h"} {
  set time 60
  set reason $botnet3
  }
if {[string tolower $otbn] == "2h"} {
  set time 120
  set reason $botnet3	
  }
if {[string tolower $otbn] == "3h"} {
  set time 180
  set reason $botnet3	
  }
if {[string tolower $otbn] == "4h"} {
  set time 240
  set reason $botnet3    
  }
if {[string tolower $otbn] == "5h"} {
  set time 300
  set reason $botnet3	
  }
if {[string tolower $otbn] == "6h"} {
  set time 360
  set reason $botnet3	
  }
if {[string tolower $otbn] == "7h"} {
  set time 420
  set reason $botnet3	
  }
if {[string tolower $otbn] == "8h"} {
  set time 480
  set reason $botnet3	
  }
if {[string tolower $otbn] == "9h"} {
  set time 540
  set reason $botnet3	
  }
if {[string tolower $otbn] == "10h"} {
  set time 600
  set reason $botnet3	
  }
if {[string tolower $otbn] == "11h"} {
  set time 660
  set reason $botnet3	
  }
if {[string tolower $otbn] == "12h"} {
  set time 720
  set reason $botnet3	
  }
if {[string tolower $otbn] == "13h"} {
  set time 780
  set reason $botnet3 	
  }
if {[string tolower $otbn] == "14h"} {
  set time 840
  set reason $botnet3	
  }
if {[string tolower $otbn] == "15h"} {
  set time 900
  set reason $botnet3	
  }
if {[string tolower $otbn] == "16h"} {
  set time 960
  set reason $botnet3	
  }
if {[string tolower $otbn] == "17h"} {
  set time 1020
  set reason $botnet3	
  }
if {[string tolower $otbn] == "18h"} {
  set time 1080
  set reason $botnet3	
  }
if {[string tolower $otbn] == "19h"} {
  set time 1140
  set reason $botnet3	
  }
if {[string tolower $otbn] == "20h"} {
  set time 1200
  set reason $botnet3	
  }
if {[string tolower $otbn] == "21h"} {
  set time 1260
  set reason $botnet3	
  }
if {[string tolower $otbn] == "22h"} {
  set time 1320
  set reason $botnet3	
  }
if {[string tolower $otbn] == "23h"} {
  set time 1380
  set reason $botnet3	
  }
if {[string tolower $otbn] == "24h"} {
  set time 1440
  set reason $botnet3	
  } 
if {[string tolower $otbn] == "1d"} {
  set time 1440
  set reason $botnet3	
  }
if {[string tolower $otbn] == "2d"} {
  set time 2880
  set reason $botnet3	
  }
if {[string tolower $otbn] == "3d"} {
  set time 4320
  set reason $botnet3	
  }
if {[string tolower $otbn] == "4d"} {
  set time 5760
  set reason $botnet3	
  }
if {[string tolower $otbn] == "5d"} {
  set time 7200 
  set reason $botnet3	
  }
if {[string tolower $otbn] == "6d"} {
  set time 8640
  set reason $botnet3
  }
if {[string tolower $otbn] == "7d"} {
  set time 10080
  set reason $botnet3	
  }
if {[string tolower $otbn] == "8d"} {
  set time 11520
  set reason $botnet3	
  }
if {[string tolower $otbn] == "9d"} {
  set time 12960
  set reason $botnet3	
  }
if {[string tolower $otbn] == "10d"} {
  set time 14400
  set reason $botnet3	
  }
if {[string tolower $otbn] == "11d"} {
  set time 15840
  set reason $botnet3	
  }
if {[string tolower $otbn] == "12d"} {
  set time 17280
  set reason $botnet3	
  }
if {[string tolower $otbn] == "13d"} {
  set time 18720
  set reason $botnet3    
  }
if {[string tolower $otbn] == "14d"} {
  set time 20160
  set reason $botnet3	
  }
if {[string tolower $otbn] == "15d"} {
  set time 21600
  set reason $botnet3	
  }
if {[string tolower $otbn] == "16d"} {
  set time 23040
  set reason $botnet3	
  }
if {[string tolower $otbn] == "17d"} {
  set time 24480
  set reason $botnet3	
  }
if {[string tolower $otbn] == "18d"} {
  set time 25920
  set reason $botnet3	
  }
if {[string tolower $otbn] == "19d"} {
  set time 27360
  set reason $botnet3	
  }
if {[string tolower $otbn] == "20d"} {
  set time 28800
  set reason $botnet3	
  }
if {[string tolower $otbn] == "21d"} {
  set time 30240
  set reason $botnet3	
  }
if {[string tolower $otbn] == "22d"} {
  set time 31680
  set reason $botnet3	
  }
if {[string tolower $otbn] == "23d"} {
  set time 33120
  set reason $botnet3	
  }
if {[string tolower $otbn] == "24d"} {
  set time 34560
  set reason $botnet3	
  }
if {[string tolower $otbn] == "25d"} {
  set time 36000
  set reason $botnet3	
  }
if {[string tolower $otbn] == "26d"} {
  set time 37440
  set reason $botnet3	
  }
if {[string tolower $otbn] == "27d"} {
  set time 38880
  set reason $botnet3	
  }
if {[string tolower $otbn] == "28d"} {
  set time 40320
  set reason $botnet3	
  }
if {[string tolower $otbn] == "29d"} {
  set time 41760
  set reason $botnet3	
  }
if {[string tolower $otbn] == "30d"} {
  set time 43200
  set reason $botnet3	
  }
if {[string tolower $otbn] == "31d"} {
  set time 44640
  set reason $botnet3	
  }
if {[string tolower $otbn] == "32d"} {
  set time 46080
  set reason $botnet3	
  }
if {[string tolower $otbn] == "33d"} {
  set time 47520
  set reason $botnet3	
  }
if {[string tolower $otbn] == "34d"} {
  set time 48960
  set reason $botnet3	
  }
if {[string tolower $otbn] == "35d"} {
  set time 50400
  set reason $botnet3	
  }
if {[string tolower $otbn] == "36d"} {
  set time 51840
  set reason $botnet3	
  }
if {[string tolower $otbn] == "37d"} {
  set time 53280
  set reason $botnet3	
  }
if {[string tolower $otbn] == "38d"} {
  set time 54720
  set reason $botnet3	
  }
if {[string tolower $otbn] == "39d"} {
  set time 56160
  set reason $botnet3	
  }
if {[string tolower $otbn] == "40d"} {
  set time 57600
  set reason $botnet3	
  }
if {[string tolower $otbn] == "41d"} {
  set time 59040
  set reason $botnet3	
  }
if {[string tolower $otbn] == "42d"} {
  set time 60480
  set reason $botnet3	
  }
if {[string tolower $otbn] == "43d"} {
  set time 61920
  set reason $botnet3	
  }
if {[string tolower $otbn] == "44d"} {
  set time 63360
  set reason $botnet3	
  }
if {[string tolower $otbn] == "45d"} {
  set time 64800
  set reason $botnet3	
  }
if {[string tolower $otbn] == "46d"} {
  set time 66240
  set reason $botnet3    
  } 	
if {[string tolower $otbn] == "47d"} {
  set time 67680
  set reason $botnet3	
  }
if {[string tolower $otbn] == "48d"} {
  set time 69120
  set reason $botnet3	
  }
if {[string tolower $otbn] == "49d"} {
  set time 70560
  set reason $botnet3	
  }
if {[string tolower $otbn] == "50d"} {
  set time 72000
  set reason $botnet3	
  }
if {$time == "0"} {
  set time 60
  set reason $botnet3

  putquick "NOTICE $nick :You Did Not Specify a Ban Time. Defaulted to 1 Hour" 
}
if {![onchan $otbn1 $chan]} {
  set hand2 [finduser $otbn1]
if {[checkaccess $handle $chan $hand2]} {
if {$reason == ""} {
  putlog "!$nick ($host)! ban $chan $otbn1 $otbn"	
  set banreason "$nick banned you (Length Of Ban: $otbn)"
  putquick "NOTICE $nick :Added new channel ban in channel record '$chan'"
if {$bcast == "1"} {
  putquick "PRIVMSG $home :\002$nick\002 ($host) requested me to ban \002$otbn1\002 in $chan. Reason: N/A. Length Of Ban: $otbn"
  }
  } else {
  putlog "!$nick ($host)! ban $chan $otbn1 $otbn $reason"
  set banreason "$nick banned you for $reason (Length Of Ban: $otbn)"
  putquick "NOTICE $nick :Added new channel ban \002$otbn1\002 in channel record '$chan'"
if {$bcast == "1"} {
  putquick "PRIVMSG $home :\002$nick\002 ($host) requested me to ban \002$otbn1\002 in $chan. Reason: $reason. Length Of Ban: $otbn"
  }
  }
  newchanban $chan $otbn1 $nick $banreason $time
  putquick "KICK $chan $otbn1 :$banreason"
  return 0
  }
  putquick "NOTICE $nick :\0034ERROR - Unable To Execute Command - Not Enough Permissions - Permission Denied."
  return 0
  }
  set hand2 [nick2hand $otbn1 $chan]
if {$hand2 == $handle} {
  putquick "NOTICE $nick :\0034ERROR - Sorry, you may not ban yourself."
  return 0
  }
if {[checkaccess $handle $chan $hand2]} {
  set hostname [getchanhost $otbn1 $chan]
if {[string match "~*" $hostname]} {
  set hostname [string range $hostname 1 end]
  }
  set banhostname [maskhost *$hostname]
if {$reason == ""} {
  putlog "!$nick ($host)! ban $chan $otbn1 ($banhostname) $otbn"
  set banreason "$nick banned you (Length Of Ban: $otbn)"
  newchanban $chan $banhostname $nick $banreason $time
  putquick "NOTICE $nick :Added new channel ban \002$otbn1 ($banhostname)\002 in channel record '$chan'"
  
  if {$bcast == "1"} {
    putquick "PRIVMSG $home :\002$nick\002 ($host) requested me to ban \002$otbn1\002 ($banhostname) in $chan. Reason: N/A. Length Of Ban: $otbn"
    }
      putquick "KICK $chan $otbn1 :$banreason"
      return 0
    }
    putlog "!$nick ($host)! ban $chan $otbn1 ($banhostname) $otbn $reason"
    set banreason "$nick banned you for $reason (Length Of Ban: $otbn)"
    newchanban $chan $banhostname $nick $banreason $time 
    putquick "NOTICE $nick :Added new channel ban \002$otbn1 ($banhostname)\002 in channel record '$chan'"
    if {$bcast == "1"} {
      putquick "PRIVMSG $home :\002$nick\002 ($host) requested me to ban \002$otbn1\002 ($banhostname) in $chan. Reason: $reason. Length Of Ban: $otbn"
    }
    putquick "KICK $chan $otbn1 :$banreason"
    return 0
  }
  putquick "NOTICE $nick :\0034ERROR - Unable To Execute Command - Not Enough Permissions - Permission Denied."
}









